//
//  HttpRequest.h
//  LeaseMC
//
//  Created by fly驰 on 16/8/18.
//  Copyright © 2016年 XFKJ. All rights reserved.
//

#import <Foundation/Foundation.h>
/** 请求成功的Block */
typedef void(^HttpRequestSuccess)(id responseObject);

/** 请求失败的Block */
typedef void(^HttpRequestFailed)(NSError *error);

/** 上传图片成功的Block */
typedef void(^HttpUploadSuccess)(id responseObject);

/** 上传图片失败的Block */
typedef void(^HttpUploadFailed)(NSError *error);

@interface HttpRequest : NSObject<NSURLSessionDelegate>

/**
 *  @brief  初始化
 */
+ (instancetype)request;

/**
 *  @brief  设置请求URL
 */
+ (void)setBaseUrl:(NSString*)baseUrl;

/**
 *  @brief  获取请求URL
 */
+ (NSString *)getBaseUrl;

/**
 *  @brief  发起请求的网络地址
 */
@property (strong, nonatomic) NSString *urlString;

/**
 *  @brief  发起请求的参数键值对
 */
@property (strong, nonatomic) NSMutableDictionary *parameters;

/**
 *  @brief  上传图片的数组
 */
@property (strong, nonatomic) NSArray *imgArr;
/**
 *  @brief  Post请求
 */
- (void)postWithManager:(id)requestOperationManager
                success:(HttpRequestSuccess)success
                failure:(HttpRequestFailed)failure;
/**
 *  @brief  Get请求
 */
- (void)getWithManager:(id)requestOperationManager
               success:(HttpRequestSuccess)success
               failure:(HttpRequestFailed)failure;

/**
 *  @brief  Post上传图片
 */
- (void)upLoadPicturesWithManager:(id)requestOperationManager
                          success:(HttpUploadSuccess)success
                          failure:(HttpRequestFailed)failure;
/**
 *  @brief  获取
 */
+ (id)requestOperationManager;

@end
